﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.Logging;

namespace AnyLink.PosClient.ViewModel
{
    public partial class SaleViewModel : ObservableObject
    {
        readonly ILogger _logger;
        public SaleViewModel(ILoggerFactory loggerFactory)
        {
            _logger = loggerFactory.CreateLogger<SaleViewModel>();
        }
        [ObservableProperty]
        private string currDateTime;
        [ObservableProperty]
        private string upDateCount;
        [ObservableProperty]
        private string versionName;


        [RelayCommand]
        private void Cancel()
        {
            _logger.LogDebug("退出程序");
            Environment.Exit(0);
        }

        [RelayCommand]
        private void Settlement()
        {
            _logger.LogDebug("结算");
            WeakReferenceMessenger.Default.Send("结算", "TipMessage");
        }
    }
}
